import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:honeypotflutter/modules/deliver/views/deliver_result_button.dart';
import 'package:honeypotflutter/modules/deliver/views/deliver_result_header.dart';
import 'package:honeypotflutter/public/views/public_appBar.dart';
import 'package:honeypotflutter/public/views/public_scrollView.dart';
import 'package:honeypotflutter/publicBussine/bussine_colors.dart';
import '../../views/deliver_result_warning.dart';
import 'logic.dart';

class DeliverSuccessPage extends StatefulWidget {
  const DeliverSuccessPage({Key? key}) : super(key: key);

  @override
  State<DeliverSuccessPage> createState() => _DeliverSuccessPageState();
}

class _DeliverSuccessPageState extends State<DeliverSuccessPage> {
  final DeliverSuccessLogic logic = Get.put(DeliverSuccessLogic());

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: MGColors.whileColor,
      appBar: HLAppBar(navigationTitle: "投递包裹", showBottomLine: true),
      body: HLScrollView(
        padding: EdgeInsets.only(left: 35, right: 35, top: 40),
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          DeliverResultHeader(
            status: "${logic.result?.displayAlias}格口",
            remind: "柜门已打开，请投递包裹后关门",
          ),
          SizedBox(height: 30),
          Obx(() => DeliverResultButton(
                firstTitle: "取消投递",
                firstAction: logic.cancelAction,
                threeTitle: logic.threeTitle.value,
                threeAction: logic.sureAction,
              )),
          SizedBox(height: 20),
          DeliverResultWarning(),
        ],
      ),
    );
  }

  @override
  void dispose() {
    Get.delete<DeliverSuccessLogic>();
    super.dispose();
  }
}
